package starter.data;

import java.util.ArrayList;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class LoginFBTestCases {
	public void runTestCases(ArrayList<String> codeInjection) throws InterruptedException {
		ArrayList<String> webElements = new ArrayList<String>();
		webElements.add("email");
		webElements.add("pass");
		loginFbSuccesfull(webElements);
	}
	
	private void loginFbSuccesfull(ArrayList<String> webElements) throws InterruptedException {
		WebDriver driver = new FirefoxDriver();
		driver.get("https://www.facebook.com/login.php?skip_api_login=1&api_key=466975030044826&signed_next=1&next=https%3A%2F%2Fwww.facebook.com%2Fdialog%2Foauth%3Fredirect_uri%3Dhttps%253A%252F%252Fwww.snapsation.com%252Flogin%252Ffacebook_callback%26state%3Dee2a468dab1f3dbe33adbc1e81f6d3c4%26scope%3Demail%26client_id%3D466975030044826%26ret%3Dlogin&cancel_uri=https%3A%2F%2Fwww.snapsation.com%2Flogin%2Ffacebook_callback%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied%26state%3Dee2a468dab1f3dbe33adbc1e81f6d3c4%23_%3D_&display=page");
		WebElement email = driver.findElement(By.name(webElements.get(0)));
		email.sendKeys("damciodamcio666@gmail.com");
		WebElement password = driver.findElement(By.name(webElements.get(1)));
		password.sendKeys("admin123admin");
	    WebElement loginFbLink = driver.findElement(By.id("u_0_1"));
	    loginFbLink.click();
		Thread.sleep(1800);
	}
}
